package de.tabuma.shopping.view;

import de.tabuma.lib.tabumaview;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.util.logging.*;

/**
 *
 * @author $Author: alefen $
 * @version $Revision: 1.2 $
 * @since $Date: 2009/07/21 19:37:33 $
 */
public class verificationOfPayment extends tabumaview {
    java.util.logging.Logger log =  java.util.logging.Logger.getLogger(verificationOfPayment.class.getName());

    String orderNav;

    public verificationOfPayment(String servlet, Hashtable parameter, String orderNav) {
        super(servlet, parameter);
        this.orderNav = orderNav;
    }

    public void processRequest(ServletContext context, HttpServletRequest request, HttpServletResponse response, PrintWriter out)  {
        try {
            out.println("<div class=\"contentContent\">");
            out.println("<p class=\"contentContentHeader\">");
            out.println(de.tabuma.shopping.constants.getValueFromProperties("orders.verificationofpayment.header"));
            out.println("</p>");
            if(request.getAttribute("wrongOrderTokenError")!=null) {
                out.println(de.tabuma.shopping.constants.getValueFromProperties("orders.verificationofpayment.wrongtokenerror"));
                out.println("<br/>");
                out.println(this.getFormBeginn(null));
                out.println(this.getHiddenAsAttribute());
                out.println("<input type=\"hidden\" name=\""+orderNav+"\" value=\""+de.tabuma.shopping.constants.ORDERNAV_NULL+"\"/>");
                out.println("<input type=\"submit\" value=\""+de.tabuma.shopping.constants.getValueFromProperties("orders.verificationofpayment.button.orderoverview")+"\" class=\"loginbutton\"/>");
                out.println("</form>");
                out.println("</div>");
            }
            else if(request.getAttribute("noOrderTokenError")!=null) {
                out.println(de.tabuma.shopping.constants.getValueFromProperties("orders.verificationofpayment.notokenerror"));
                out.println("<br/>");
                out.println(this.getFormBeginn(null));
                out.println(this.getHiddenAsAttribute());
                out.println("<input type=\"hidden\" name=\""+orderNav+"\" value=\""+de.tabuma.shopping.constants.ORDERNAV_NULL+"\"/>");
                out.println("<input type=\"submit\" value=\""+de.tabuma.shopping.constants.getValueFromProperties("orders.verificationofpayment.button.orderoverview")+"\" class=\"loginbutton\"/>");
                out.println("</form>");
                out.println("</div>");
            }
            else if(request.getAttribute("errorInConnectionWithPayPal")!=null) {
                out.println(de.tabuma.shopping.constants.getValueFromProperties("orders.verificationOfpayment.errorinconnectionwithpaypal"));
                out.println("<br/>");
                out.println(this.getFormBeginn(null));
                out.println(this.getHiddenAsAttribute());
                out.println("<input type=\"hidden\" name=\""+orderNav+"\" value=\""+de.tabuma.shopping.constants.ORDERNAV_NULL+"\"/>");
                out.println("<input type=\"submit\" value=\""+de.tabuma.shopping.constants.getValueFromProperties("orders.verificationofpayment.button.orderoverview")+"\" class=\"loginbutton\"/>");
                out.println("</form>");
                out.println("</div>");
            }
            else {
                out.println(de.tabuma.shopping.constants.getValueFromProperties("orders.verificationofpayment.content"));
                out.println("<br/>");
                out.println("<br/>");
                out.println(this.getFormBeginn(null));
                out.println(this.getHiddenAsAttribute());
                out.println("<input type=\"hidden\" name=\""+orderNav+"\" value=\""+de.tabuma.shopping.constants.ORDERNAV_DETAILS+"\"/>");
                out.println("<input type=\"hidden\" name=\""+de.tabuma.shopping.constants.ORDER_NR+"\" value=\""+request.getAttribute(de.tabuma.shopping.constants.ORDER_NR)+"\"/>");
                out.println("<input type=\"submit\" value=\""+de.tabuma.shopping.constants.getValueFromProperties("orders.verificationofpayment.button.orderdetails")+"\" class=\"loginbutton\"/>");
                out.println("</form>");
                out.println("</div>");
            }
            
        }
        catch(Exception e) {
            log.warning(e.getMessage());
        }
    }

}
